package com.customview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Created by Administrator on 2017/1/19.
 * 组合布局
 */
public class TitleBarLayout extends RelativeLayout {


    TextView tv_title;
    ImageView img;


    public TitleBarLayout(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        //加载布局
       View view= LayoutInflater.from(context).inflate(R.layout.titlebar_layout,this);

        //获取控件
        tv_title= (TextView) findViewById(R.id.tv_title);
        img= (ImageView)findViewById(R.id.img);
        //


    }
    public void setimgListenr(OnClickListener listener)
    {
     img.setOnClickListener(listener);
    }
    public  void  sttvListen(OnClickListener listener)
    {
        tv_title.setOnClickListener(listener);

    }

    public void setTv_title(String tx)
    {
        tv_title.setText(tx);
    }


}
